#define	_CRT_SECURE_NO_WARNINGS 1

#include "DList.h"

void TestList1()
{
	ListNode* pList = InitList();

	ListPushBack(pList, 1);
	ListPushBack(pList, 2);
	ListPushBack(pList, 3);
	ListPushBack(pList, 4);
	ListPrint(pList);
	
	ListPopBack(pList);
	ListPopBack(pList);
	ListPrint(pList);
}

void TestList2()
{
	ListNode* pList = InitList();

	ListPushBack(pList, 1);
	ListPushBack(pList, 2);
	ListPushBack(pList, 3);
	ListPushBack(pList, 4);
	ListPrint(pList);

	ListPushFront(pList, 0);
	ListPushFront(pList, -1);
	ListPushFront(pList, -2);
	ListPrint(pList);

	ListPopFront(pList);
	ListPopFront(pList);
	ListPopFront(pList);
	ListPopFront(pList);
	ListPopFront(pList);
	ListPopFront(pList);
	ListPrint(pList);


}

void TestList3()
{
	ListNode* pList = InitList();

	ListPushBack(pList, 1);
	ListPushBack(pList, 2);
	ListPushBack(pList, 3);
	ListPushBack(pList, 4);
	ListPrint(pList);
	
	ListNode* pos = ListFind(pList, 3);
	if (pos)
	{
		ListInsert(pos, 10);
	}

	ListPrint(pList);

	if (pos)
	{
		ListErase(pos);
	}

	ListPrint(pList);

	ListDestory(pList);
}

int main()
{
	TestList1();
	TestList2();
	TestList3();

	return 0;
}